Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: adding unit tests for common #113

Merged
merged 4 commits into from
Feb 2, 2022

Conversation

anandsunderraman
Copy link
Collaborator

Description

Adding unit tests to components

Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, left just few recommendations

package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated
"release": "semantic-release",
"lint": "eslint --max-warnings 0 --fix --config .eslintrc .",
"generate:readme:toc": "markdown-toc -i README.md",
"generate:assets": "npm run generate:readme:toc",
"bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION"
"bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION",
"testComponents": "rimraf test/temp && jest --coverage ./test/components"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not put anything in test/temp so no need to remove it and using rimraf. I guess you saw it in other templates but this is related to not unit testing but a kind of integration testing where you actually run generator and then check if generated app matches the snapshot. Definitely another set of tests I recommend to add after this PR (example asyncapi/nodejs-template#103)

import { GetProtocolFlags, GetSubscriberFlags, pascalCase } from '../../components/common';
import AsyncAPIDocument from '@asyncapi/parser/lib/models/asyncapi';

const docWithoutChannels = new AsyncAPIDocument({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend to take these example files from test into separate files, and then just read them from file. This way you can share them in future with others tests, like integration tests

derberg
derberg previously approved these changes Feb 1, 2022
Copy link
Member

@derberg derberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks very good, just remove rimraf and yeah heading on to @smoya to approve as my approval doesn't count here

package.json Outdated
@@ -33,7 +34,8 @@
"@asyncapi/generator-filters": "^2.0.0",
"@asyncapi/generator-hooks": "^0.1.0",
"@asyncapi/generator-react-sdk": "^0.2.23",
"@asyncapi/modelina": "^0.45.0"
"@asyncapi/modelina": "^0.45.0",
"rimraf": "^3.0.2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you do not use it, you can remove and update package-lock

Copy link
Member

@smoya smoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍 🚀

@anandsunderraman anandsunderraman merged commit 7564dad into asyncapi:master Feb 2, 2022
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 0.1.35 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants